class XMLFileStringManager

	attr_accessor :fileName
	attr_accessor :filXMLString

	def initialize

		puts "Input File Name..."

		@fileName = gets
		@fileName = @fileName.chomp

		file = File.open(@fileName, "r")

		@fileXMLString = file.read

		file.close

	end

	def removeXMLHeader

		# remove XML header if it exists 
		if(@fileXMLString.match "<?")

			# known line feed at the end of XML header
			finalSlice = @fileXMLString.index "\n"
			# remove XML header
			@fileXMLString.slice!(0..finalSlice)

		end

	end

	def getTagAttributes
		openTag = @fileXMLString.index "<"
		closeTag = @fileXMLString.index ">"

		return @fileXMLString.slice!(openTag..closeTag)
	end

def getTagTail
  openTag = @fileXMLString.index "<"
  closeTag = @fileXMLString.index "/>"

    return @fileXMLString.slice!(openTag..closeTag)
  end

  def getTagContent
    openTag = @fileXMLString.index "<"

    if(nil == openTag or 0 == openTag)
      return ""
    else
      return @fileXMLString.slice!(0..openTag - 1)
    end

  end

	def isNextTagTail
    endTag = @fileXMLString.index "</"
		startTag = @fileXMLString.index "<"

    return startTag == endTag
	end

  def isNextTagHead
    endTag = @fileXMLString.index "</"
    startTag = @fileXMLString.index "<"

    return startTag != endTag
  end

end

